module breathing_led(
	input clk_51200Hz,
	input[7:0] led_state,
	output reg[7:0] led_out
);

	parameter STATE4 = 7'd70;
	parameter STATE3 = 7'd35;
	parameter STATE2 = 7'd5;
	parameter STATE1 = 7'd1;
	
	reg[6:0] count = 7'd0;
	
	always @(posedge clk_51200Hz) begin

		if(count <= STATE1) begin
			led_out = led_state | (led_state >> 1) | (led_state >> 2) | (led_state >> 3);
		end
		else if(count <= STATE2) begin
			led_out = led_state | (led_state >> 1) | (led_state >> 2);
		end
		else if(count <= STATE3) begin
			led_out = led_state | (led_state >> 1);
		end
		else if(count <= STATE4) begin
			led_out = led_state;
		end
		else begin
			led_out = 8'd0;
		end

		/*if(count <= STATE4) begin
			led_out = led_state;
		end
		else begin
			led_out = 8'b0000_0000;
		end*/
		
		if(count == 7'd127) begin
			count = 7'd0;
		end
		else begin
			count = count + 7'd1;
		end
		
	end

endmodule
